package java_objects.nested_class;

public class OuterClass3 {
	static class NestedClass {
		int x;
		static int y;
		void test1(){
			System.out.println("Non static method");
		}
		static void test2(){
			System.out.println("static method");
		}
	}
	public static void main(String[] args) {
		
		// How to reference non static variable
		new OuterClass3.NestedClass().x = 10;
		
		// How to reference static variable
		OuterClass3.NestedClass.y = 20;
		
		// How to call NON static method
		new OuterClass3.NestedClass().test1();
		
		// How to call static method
		OuterClass3.NestedClass.test2();
		
		// How to get a reference to NestedClass instance
		NestedClass ref = new OuterClass3.NestedClass();
		ref.x = 10;
		ref.test1();
		
		
	}
}

